Skip to content

MLE-30154 Pin Mocha to 11.7.5#1088

Merged
jonmille merged 1 commit into
developfrom
MLE-30154
Jul 1, 2026
Merged

MLE-30154 Pin Mocha to 11.7.5#1088
jonmille merged 1 commit into
developfrom
MLE-30154

Conversation

@jonmille

@jonmille jonmille commented Jun 30, 2026

Copy link
Copy Markdown

Pin Mocha to 11.7.5 to resolve ERR_MOCHA_MULTIPLE_DONE crash in transformAll tests

Problem

The test-complete suite was producing 16 test failures in Jenkins for two test files:

  • nodejs-dmsdk-xmlFiles-transformAll.js (15 failures)
  • nodejs-dmsdk-txtFiles-transformAll.js (1 failure)

Every affected test showed done() called multiple times with this pattern:

Error: done() called multiple times in test <...>; in addition, done() received error:
Error: Timeout of 20000ms exceeded.
{ code: 'ERR_MOCHA_TIMEOUT', timeout: 20000 }
{ code: 'ERR_MOCHA_MULTIPLE_DONE' }
Exit code: 7

All individual test assertions were actually passing (Mocha reported N passing), but the Mocha runner crashed post-suite with exit code 7, causing Jenkins to report the entire file as failed.

The crash originated in the afterEach hook, which calls documents.remove(uris) to clean up 100 documents after each test. On slower environments (Jenkins), this operation occasionally exceeds the hook's 20-second timeout. When the timeout fires, Mocha calls done() with the timeout error; when remove() eventually completes, it calls done() a second time, triggering ERR_MOCHA_MULTIPLE_DONE and crashing the process.

Fix

Pinning Mocha to 11.7.5 resolves the crash. This version handles the ERR_MOCHA_MULTIPLE_DONE edge case without terminating the process, allowing the suite to exit cleanly (exit code 0). No changes to test source files were required.

Verification

All three previously failing test files were re-run locally against marklogic-server-ubi:11.3.20260630-ubi-2.2.5 after the upgrade:

Test File Tests Result
nodejs-dmsdk-xmlFiles-transformAll.js 17 ✅ 17 passing, exit 0
nodejs-dmsdk-txtFiles-transformAll.js 15 ✅ 15 passing, exit 0
nodejs-temporal-advance-lsqt.js 12 ✅ 12 passing, exit 0

Note: This issue started as a result of this PR: #1085

Copilot AI review requested due to automatic review settings June 30, 2026 19:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pins Mocha to a fixed patch version to stabilize the test runner behavior in CI (addressing the reported ERR_MOCHA_MULTIPLE_DONE/timeout interaction during afterEach cleanup).

Changes:

  • Pin mocha devDependency to 11.7.5 (remove ^ range) in package.json.
  • Update package-lock.json to lock Mocha to 11.7.5 (including the resolved tarball/integrity), avoiding 11.7.6.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
package.json Pins Mocha version to prevent patch-level drift in CI.
package-lock.json Updates the lockfile to ensure Mocha resolves to 11.7.5 consistently.

Comment thread package.json
@jonmille jonmille merged commit 794c2c6 into develop Jul 1, 2026
5 checks passed
@jonmille jonmille deleted the MLE-30154 branch July 1, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants